<script setup>
import { inject, ref } from "vue";
// import stepsview from "../components/steps/steps.vue";
import { useCounterStore } from "@/stores/upgrade";
import { handleGoBack } from "@/utils/router";
import { upgradecreate, upgradeagreeInfo } from "@/services/upfrade";
import { uploadfile } from "@/services/upload";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { base_URL } from "@/utils/http";
import { refunddetail } from "@/services/order";
onLoad((e) => {
  if (e.refund_id) {
    getdet(e.refund_id);
  }
});
const detobj = ref({});
async function getdet(id) {
  let res = await refunddetail({ refund_id: id });
  detobj.value = res.data;
}
const goreturnaddressfun = () => {
  uni.redirectTo({
    url: "/pages/order/returnadress/index?refund_id=" + detobj.value.refund_id,
  });
};

const copyfun = () => {
  uni.setClipboardData({
    data:
      detobj.value.mer_delivery_user +
      " " +
      detobj.value.phone +
      " " +
      detobj.value.mer_delivery_address,
    success: function () {
      uni.showToast({
        title: "已复制到粘贴板",
        icon: "none",
      });
    },
  });
};
</script>

<template>
  <view class="content">
    <!-- <view class="content-top">
      <view class="content-top-title">售后申请已提交</view>
      <view class="content-top-dec">请在<text>两天内</text>提交快递单号</view>
    </view> -->
    <view class="content-sm"
      >售后同意后，请按照给出的退货地址退货，并请记录退货运单号。</view
    >

    <view class="content-address">
      <view class="content-addr-sj">
        <view class="content-addr-sj-left">
          <view class="content-addr-sj-left-title"
            >退货地址：{{ detobj.mer_delivery_user }} {{ detobj.phone }}
          </view>

          <view class="content-addr-sj-left-dec">{{
            detobj.mer_delivery_address
          }}</view>
        </view>
        <view>
          <text class="content-addr-sj-right" @click="copyfun">复制</text>
        </view>
      </view>

      <view class="content-addr-sm"
        >未与平台协商一致，请勿使用到付或平邮，以免商家拒签货物，请在退货有效期填写退货快递单号，逾期未填写，退货申请将撤销</view
      >
      <view class="content-addr-bt" @click="goreturnaddressfun"
        >填写物流单号</view
      >
    </view>

    <view class="list">
      <view class="list-item">
        <!-- <view class="list-item-title">
          <text>订单编号：49832483231</text>
          <text class="list-item-title">待支付</text>
        </view> -->
        <view class="list-item-content">
          <view
            class="list-item-content-item"
            v-for="(item, index) in detobj.refundProduct"
            :key="index"
          >
            <view class="list-item-content-img">
              <image
                :src="
                  item.order_product_info ? item.order_product_info.image : ''
                "
                mode="widthFix"
              ></image>
            </view>
            <view class="list-item-content-info">
              <view class="list-item-content-info-title">
                <view class="good-name">
                  <text>{{
                    item.order_product_info
                      ? item.order_product_info.store_name
                      : ""
                  }}</text>
                </view>
                <view>
                  <text class="good-name-mr">默认</text>
                </view>
              </view>
              <view class="list-item-price">
                <view
                  >¥{{
                    item.order_product_info ? item.order_product_info.price : 1
                  }}</view
                >
                <view class="good-name-num">{{
                  item.refund_num ? item.refund_num : 0
                }}</view>
                <view
                  ><text class="good-name-text-index">{{
                    item.status_text
                  }}</text>
                </view>
              </view>
              <!-- <view
                v-if="detobj.status == 1"
                class="list-item-btn-item-left-btn"
                @click="jcfun(detobj.refund_id)"
                >寄快递</view
              > -->
            </view>
          </view>
        </view>

        <!-- <view class="list-nums">
          <text>共1件, </text>
          <text>总计：</text><text class="list-nums-s">¥2000</text>
        </view>
        <view class="list-item-btn">
          <view class="list-item-btn-item-left">取消订单</view>
          <view class="list-item-btn-item-right">立即支付</view>
        </view> -->
      </view>
    </view>
  </view>

  <u--form>
    <view class="user-form">
      <!-- required="true" -->
      <u-form-item label="退款原因" prop="name" borderBottom ref="item1">
        <view class="select">{{ detobj.refund_message }}</view>
      </u-form-item>
      <u-form-item label="退款金额" prop="phone" borderBottom ref="item1">
        <view class="select">¥{{ detobj.refund_price }}</view>
      </u-form-item>
      <view class="item-line">
        <u-form-item label="备注" prop="card_no" borderBottom ref="item1">
          <view class="select">{{ detobj.mark ? detobj.mark : "---" }}</view>
        </u-form-item>
      </view>
    </view>
    <!-- 
    <view class="uplade-up">
      <view class="uplade-up-title">上传凭证（3/6）</view>
     
      <up-upload
        :fileList="fileList4"
        @afterRead="
          (val) => {
            afterRead4(val, 4);
          }
        "
        @delete="
          (val) => {
            deletePic4(val, 4);
          }
        "
        name="1"
        multiple
        :maxCount="6"
      ></up-upload>
    </view> -->
  </u--form>

  <!-- <view class="content-footer">
    <view class="contebt-pays">
    
      <up-button
        @click="shoppayfun"
        color="#F3498B "
        class="pay-bt pay-df"
        :text="'提交'"
      ></up-button>
    </view>
  </view> -->
  <up-picker
    :show="show"
    @cancel="closefun"
    @close="closefun"
    :columns="columns"
    @confirm="confirmfun"
  ></up-picker>
</template>

<style lang="scss" scoped>
@import "./index.scss";
</style>
